import { fetchGet, fetchPost } from "../utils/http.js";

/**
 * 获取something
 */
export const fnGetNineList = (param) => {
    let types = {
        'nine': 'Goods/quan99',
        'nineteen': 'Goods/quan19',
        'juhuasuan': 'Goods/juhuasuan',
        'taoqianggou': 'Goods/taoqianggou',
        'rexiao': 'Goods/rexiao',
        'douhuo': 'Goods/douhuo'
    }
    let {type, ...params} = param;
    return fetchPost(types[param.type], params);
};

export const fnGetDiscountList = (param) => {
    return fetchPost("Goods/quan", param);
};
export const fnSearchData = (param) => {
    return fetchPost("Goods/quan_search", param);
};

export const fnGetDetail = (param) => {
    return fetchPost("Goods/quanDetail", param);
}

export const fnGetTui = (param) => {
    let types = {
        'nine': 'Goods/quan_tui',
        'nineteen': 'Goods/quan19_tui'
    }
    return fetchPost(types[param.type] ? types[param.type] : 'Goods/quan_tui', param);
}

export default {
    fnGetNineList,
    fnGetDiscountList,
    fnSearchData,
    fnGetDetail,
    fnGetTui
}